package com.tsingteng.cosfun.ui.message;

import com.tsingteng.cosfun.bean.NotificationBean;
import com.tsingteng.cosfun.callback.RxObserver;
import com.tsingteng.cosfun.mvp.presenter.BasePresenter;

/**
 * 描述 :
 * 创建人: 肖利.
 * 时间:2018/8/6
 * qq(872179966)
 */

public class MessagePresenter extends BasePresenter<MessageContract.IMessageView> implements MessageContract.IMessagePresenter{
    MessageContract.IMessageView view;
    private final MessageModel messageModel;

    public MessagePresenter() {
        messageModel = new MessageModel();
    }

    @Override
    public void loginUserNotification(String user_type, int page) {
        view = getView();
        RxObserver<NotificationBean> rxObserver = new RxObserver<NotificationBean>(this) {
            @Override
            protected void onFaile(int errorCode, String errorMsg) {

            }

            @Override
            protected void onSuccess(NotificationBean notificationBean) {
                if(notificationBean != null){
                    view.getShowUserData(notificationBean);
                }
            }
        };
        messageModel.getUserNotification(user_type,page,rxObserver);
        addDisposable(rxObserver);
    }
}
